package com.ruoyi.weiriya.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.ruoyi.weiriya.domain.WMemberChargeRecord;
import com.ruoyi.weiriya.domain.WMemberDepositRecord;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 用户停车记录Mapper接口
 * 
 * @author lynn
 * @date 2023-08-01
 */
public interface WMemberDepositRecordMapper extends BaseMapper<WMemberDepositRecord>
{

    @Select("SELECT mdr.*, m.nick_name as member_name, a.name as area_name, vnct.type_value as vehicle_type_name " +
            "FROM w_member_deposit_record mdr " +
            "LEFT JOIN w_member m on m.id = mdr.member_id " +
            "LEFT JOIN w_vehicle_non_charge_type vnct on vnct.id = mdr.vehicle_type " +
            "LEFT JOIN w_area a on a.id = mdr.area_id ${ew.customSqlSegment}")
    List<WMemberDepositRecord> getList(@Param(Constants.WRAPPER) QueryWrapper<WMemberDepositRecord> queryWrapper);

    @Select("SELECT mdr.*, m.nick_name as member_name, a.name as area_name " +
            "FROM w_member_deposit_record mdr " +
            "LEFT JOIN w_member m on m.id = mdr.member_id " +
            "LEFT JOIN w_area a on a.id = mdr.area_id" +
            "WHERE mdr.id = #{id}")
    WMemberDepositRecord getWMemberDepositRecordById(String id);
}
